﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EFCodeFirstTest
{
    class Program
    {
        static void Main(string[] args)
        {

            var deptSoftware = new Department() { DeptName = "Software" };
            var deptIT = new Department() { DeptName = "IT" };

            using (var db = new EmpDeptContext())
            {
                new List<Employee> 
    {
        new Employee(){FirstName = "Wriju", LastName = "Ghosh", Department = deptSoftware},
        new Employee(){FirstName = "Saswati", LastName = "Sanyal", Department = deptSoftware},
        new Employee(){FirstName = "Wrishika", LastName = "Ghosh", Department = deptSoftware},
        new Employee(){FirstName = "Writam", LastName = "Ghosh", Department = deptIT},
        new Employee(){FirstName = "Debajyoti", LastName = "Ghosh", Department = deptIT},
        new Employee(){FirstName = "Sumitra", LastName = "Ghosh", Department = deptIT}
    }.ForEach(e => db.Emps.Add(e));
                int records = db.SaveChanges();
                Console.WriteLine("{0} record(s) saved", records);
            }


        }
    }
}
